package com.alib.springcloud.controller;


import com.alib.springcloud.entities.CommonResult;
import com.alib.springcloud.entities.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController // 响应json + 设置为控制类
@Slf4j
public class OrderZookeeperController {
    @Autowired
    RestTemplate restTemplate;

    private static final String PAYMENT_URL = "http://cloud-provider-payment8004";

    @GetMapping(value = "/consumer/payment/zk")
    public String getZk(){
        String forObject = restTemplate.getForObject(PAYMENT_URL + "/payment/zookeeper", String.class);
        log.info("消费者，请求zk结果：" + forObject);
        return forObject;
    }
}
